﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OutMatReturnAdd.aspx.cs"
    Inherits="BySoft.Web.Site.OutSource.OutMatReturnAdd" MasterPageFile="~/MastePage/SubEmptyMaster.Master" %>

<%@ MasterType VirtualPath="~/MastePage/SubEmptyMaster.Master" %>
<%@ Register Assembly="OneSoft.Web" Namespace="OneSoft.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register Src="../UserControl/SuggestTextBox2.ascx" TagName="SuggestTextBox2"
    TagPrefix="uc1" %>
<%@ Register Assembly="BySoft.Web.Controls" Namespace="BySoft.Web.Controls" TagPrefix="cc1" %>
<asp:Content ID="cphHeadContent" runat="server" ContentPlaceHolderID="EmptyMasteCPH">
    <script language="javascript" type="text/javascript">
        $(function () {
            $("#tabs").tabs({ show: function (event, ui) { iframeAutoFit(); } });
        });

        function Refreashtab() {
            $("#tabs").tabs({ show: function (event, ui) { iframeAutoFit(); } });
        }



        function OpenOutOrderID() {
            var currentID =  document.getElementById("<%=lblBillID.ClientID%>").value ;

            ShowTopDialog('出厂指令单选择', '../ComPage/QuerySOutMatReturnOrderID.aspx?id=' + currentID, 'FillOutOrderID();', 1000, 600); return false;
        }
        //工序回调
        function FillOutOrderID() {
         
            var str = getCookie(dialogReturn_key);

             if (str != null && str != "") {
                str = decodeURIComponent(str);
         
                     document.getElementById("<%=txtOutOrderID.ClientID%>").value = str;
                    document.getElementById("<%=hidOutOrderID.ClientID%>").value = str;
             
              



                $("#<%=btnSelectOutOrderID.ClientID %>").click();
           
            }
            setCookie(dialogReturn_key, "");
        }


        <%-- function OpenDetail() {
            var strApply = $("#<%=txtOutOrderID.ClientID %>").val();
            if (strApply == "") {
                ShowTopAlert("提示", "请选择出厂指令单号码！");
                return;
            }
            ShowTopDialog('新增', '../ComPage/QueryMOutMatReturn.aspx?BillID=' + strApply, 'FillDetail();', 800, 600); return false;
        }

        function FillDetail() {
            var str = getCookie(dialogReturn_key);
            if (str != null && str == "success") {
                $("#<%=btnAddh.ClientID %>").click();
            }
            setCookie(dialogReturn_key, "");
        }--%>

      
    </script>

    <h1 class="tit">委外 >> <a href="OutMatReturnList.aspx">委外件退料</a> >> 新增</h1>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="tableStyle2">
                <table cellpadding="0" cellspacing="0" id="tBase" runat="server">
                    <tr>
                        <th class="left2">表单号码：
                        </th>
                        <td class="right2">
                            <asp:Label CssClass="lblreadonly" ID="lblBillID" runat="server"></asp:Label>
                        </td>
                        <th class="left2">日期：
                        </th>
                        <td class="right2">
                            <asp:Label CssClass="lblreadonly" ID="lblBillDate" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <th width="20%">委外指令单号：
                        </th>
                        <td width="30%">
                            <asp:TextBox ID="txtOutOrderID" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"></asp:TextBox>
                             
                             <asp:HiddenField ID="hidOutOrderID" runat="server" />
                           
                            <asp:RequiredFieldValidator ID="rfvOutOrderID" runat="server" ErrorMessage="请选择委外单号！"
                                ControlToValidate="txtOutOrderID" Display="None" ValidationGroup="gSubmit">
                            </asp:RequiredFieldValidator>

                            <asp:Button ID="btnSelectOutOrderID" runat="server" CssClass="Hidden" OnClick="btnSelectOutOrderID_Click" />

                            <span style="color: Red">*</span>
                            <a onclick="OpenOutOrderID();">
                                <img src="../App_Themes/Common_CSS/images/GridDetail.gif" alt="" /></a>
                        </td>
                        <th width="20%">制造号码：
                        </th>
                        <td width="30%">
                            <asp:TextBox ID="txtWorkOrderNo" ReadOnly="true" runat="server" MaxLength="50" CssClass="text ui-widget-content ui-corner-all"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th width="20%">排程单号：
                        </th>
                        <td width="30%">
                            <asp:TextBox ID="txtScheduleID" ReadOnly="true" runat="server" MaxLength="50" CssClass="text ui-widget-content ui-corner-all"></asp:TextBox>
                        </td>

                        <th width="20%">委外厂商：
                        </th>
                        <td width="30%">

                            <asp:HiddenField ID="hidSupplierID" runat="server" />
                            <asp:TextBox ID="txtSupplierName" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>

                        </td>
                    </tr>
                </table>
            </div>
               </ContentTemplate>
    </asp:UpdatePanel>
      
     <asp:UpdatePanel ID="UpdatePanel2" runat="server">
     <ContentTemplate>
            <div class="tableStyle">
                <div id="tabs">
                    <ul>
                        <li><a href="#tabs-1">明细</a></li>
                    </ul>
                    <div id="tabs-1" class="tableStyle">
                        <%-- <div style="text-align: right; width: 100%; padding-bottom: 10px">
                            <label class="btnStylec png_bg">
                                <asp:Button ID="btnAdd" runat="server" Text="新增" OnClick="btnAdd_Click" />
                            </label>
                            <label class="btnStylec png_bg">
                                <asp:Button ID="btnAddh" runat="server" CssClass="Hidden" OnClick="btnAddh_Click" />
                            </label>
                        </div>--%>
                        <div class="divscroll">
                            <asp:SGridView runat="server" ID="grdResult" Width="100%" ShowActionToolBar="false"
                                OnRowDataBound="grdResult_RowDataBound" OnRowCommand="grdResult_RowCommand" AutoGenerateColumns="false"
                                AllowCascade="false">
                                <Columns>
                                    <asp:TemplateField HeaderText="序号">
                                        <ItemTemplate>
                                            <%# Container.DisplayIndex+1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="OutOrderDetailID" ItemStyle-CssClass="Hidden" FooterStyle-CssClass="Hidden" HeaderStyle-CssClass="Hidden">
                                        <ItemTemplate>
                                            <asp:Label ID="lblOutOrderDetailID" Text='<%#Eval("OutOrderDetailID") %>' runat="server"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            原料编号
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblMaterialID" runat="server" Text='<%# Eval("MaterialID") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <HeaderTemplate>类别</HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblMaterialTypeName" runat="server" Text='<%#  Eval("MaterialTypeName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>


                                    <asp:TemplateField>
                                        <HeaderTemplate>品名</HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblsMaterialName" runat="server" Text='<%#  Eval("MaterialName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField>
                                        <HeaderTemplate>规格</HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="txtSpecifications" runat="server" Text='<%#  Eval("Specifications") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField>
                                        <HeaderTemplate>单位</HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="txtUnit" runat="server" Text='<%#  Eval("Unit") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>


                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            发料数量
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblSendNum" runat="server" Text='<%#Eval("SendNum") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            可退数量
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblCanBackNum" runat="server" Text='<%#Eval("CanBackNum") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            退料数量
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:TextBox CssClass="fullWidth" ID="txtBackNum" Width="80px" runat="server" Text='<%#Eval("Nums") %>'></asp:TextBox>


                                            <asp:RegularExpressionValidator ControlToValidate="txtBackNum" Display="None" ErrorMessage="退料数量输入有误，请重新输入！" ID="revBackNum" ValidationExpression="\d*(\.\d*)?" ValidationGroup="gSubmit" runat="server"></asp:RegularExpressionValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            退料原因
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:TextBox CssClass="fullWidth" ID="txtReturnReason" Width="150px" runat="server" Text='<%#Eval("ReturnReason") %>'></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            赔偿金额
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:TextBox CssClass="fullWidth" ID="txtCompensateAmount" Width="150px" runat="server" Text='<%#Eval("CompensateAmount") %>'></asp:TextBox>
                                            <asp:RegularExpressionValidator ControlToValidate="txtCompensateAmount" Display="None"
                                                ErrorMessage="赔偿金额输入有误，请重新输入！" ID="revCompensateAmount"
                                                ValidationExpression="\d*(\.\d*)?" ValidationGroup="gSubmit" runat="server"></asp:RegularExpressionValidator>


                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField>
                                        <HeaderStyle Width="35px" />
                                        <ItemStyle Width="35px" />
                                        <HeaderTemplate>
                                            删除
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:ImageButton ImageUrl="~/App_Themes/Common_CSS/images/delete_small.gif" runat="server"
                                                ID="ibtnDel" /><asp:Button ID="btnDel" runat="server" CssClass="Hidden" CommandArgument='<%# Container.DisplayIndex %>'
                                                    CommandName="del" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:SGridView>
                        </div>
                    </div>
                </div>
            </div>
            <div class="controlBar" align="center">
                <table cellpadding="0" cellspacing="0" style="width: 300px; margin: 0 auto;">
                    <tr>
                        <td colspan="4">
                            <label class="btnStyleb png_bg">
                                <asp:Button ID="btnSubmit" runat="server" Text="确定"
                                    OnClick="btnSubmit_Click" ValidationGroup="gSubmit" />
                            </label>
                            <label class="btnStylec png_bg">
                                <input type="button" id="Button2" value="返回" runat="server" onclick="window.location = 'OutMatReturnList.aspx'" />
                            </label>
                        </td>
                    </tr>
                </table>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>


